package com.yc.web.api;


import com.yc.web.bean.ResponseResult;
import com.yc.configs.FeignMultipartSupportConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

//这是一个文件上传的feign接口，上传的文件的协议需要另外配置.
@FeignClient(   name="pro-fileLoad", configuration = FeignMultipartSupportConfig.class)
public interface FileUploadApi {

    @RequestMapping(  value="/upload",method = RequestMethod.POST,  consumes = MediaType.MULTIPART_FORM_DATA_VALUE )
    public ResponseResult upload(
            @RequestPart("uploadFiles") MultipartFile[] uploadFiles
    );


    @PostMapping(value = "/upload/files", consumes = "multipart/form-data")
    ResponseEntity<List<String>> uploadFiles(@RequestPart("files") MultipartFile[] files);
}
